<script setup>
	import {
		ref
	} from "vue";
	import {
		imgUrl
	} from "../../../utils/global";
	const typeList = ref(["全部", "医疗", "疫苗"]);
	const currentType = ref(0);
	import {
		onLoad
	} from '@dcloudio/uni-app';
	import {
		getinformationlist
	} from '@/api/index';
	const health_list=ref([])
	onLoad((options) => {
		getHealthList()
	})
	// 健康百科列表
	const getHealthList = () => {
		getinformationlist().then(res=>{
			health_list.value=res
		})
	};
	// 健康百科详情
	const healthDetail=(id)=>{
		uni.navigateTo({
			url:"/pages/wiki/detail/index?id="+id
		})
	}
</script>

<template>
	<view class="app-wiki"> 
	<!-- 	<view class="type-wrapper">
			<text :class="currentType === index ? 'type-active' : ''" v-for="(item, index) in typeList"
				:key="`type-item-${index}`" @click="currentType = index">{{ item }}</text>
		</view> -->
		<view class="list-wrapper">
			<view class="item-wrapper" v-for="(item,index) in health_list" :key="item.id" @click="healthDetail(item.id)">
				<view class="item-left">
					<text>{{item.title}}</text>
					<text>{{item.release_time}}</text>
				</view>
				<image :src="imgUrl(item.img)" mode="aspectFill" />
			</view>
		</view>
	</view>
</template>

<style src="./style.scss" scoped />